package com.zykj.decorate.myio;

import com.sun.scenario.effect.Offset;

import java.io.*;

/**
 * @author zhoulj(周利军) [1217102780@qq.com]
 * @Title: LowerCaseInputStream
 * @Project: ${MODEL_NAME}
 * @Module ID:   <(模块)类编号，可以引用系统设计中的类编号>
 * @Comments: <对此类的描述，可以引用系统设计中的描述>
 * @JDK version used:      <JDK1.8> 14
 * @since 2018/12/26-22:14
 */
public class LowerCaseInputStream extends FileInputStream {
    public LowerCaseInputStream(File file) throws FileNotFoundException {
        super(file);
    }

    public int read() throws IOException {
        int c= super.read();
        return c==-1?c:Character.toLowerCase((char) c);
    }

    public int read(byte b[], int off, int len) throws IOException {
        int result = super.read(b, off, len);
        for (int i = off; i < off + result; i++) {
            b[i] = (byte)Character.toLowerCase((char)b[i]);
        }
        return result;
    }
}
